package com.atguigu.rabbitmq.producer.controller;

import com.atguigu.rabbitmq.producer.config.RabbitDLXConfiguration;
import com.atguigu.rabbitmq.producer.entiry.GlobalCorrelationData;
import com.atguigu.rabbitmq.producer.service.RabbitMQService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author ChenYongSheng
 * Date 2025/11/2 16:17
 */
@RestController
@RequestMapping("rabbit")
public class RetryController {

    @Autowired
    private RabbitMQService rabbitMQService;

    @GetMapping("test02")
    public String test02(){
        rabbitMQService.sendDelayMsg( "hello delay-queue",2000);
        return "success";
    }

    @GetMapping("test01")
    public String test01(){
        rabbitMQService.sendMsg("topic_exchange","error","test",new GlobalCorrelationData());
        return "success";
    }
}
